<template>
  <div id="app">
    <star-background />
    <div class="router-container">
      <router-view />
    </div>
  </div>
</template>

<script>
import StarBackground from './components/StarBackground.vue';

export default {
  name: 'App',
  components: {
    StarBackground
  },
  mounted() {
    console.log('App组件已挂载');
    console.log('当前路由:', this.$route.path);
    console.log('登录状态:', localStorage.getItem('isLoggedIn'));

    // 清除可能存在的旧登录状态（用于测试）
    // localStorage.removeItem('isLoggedIn');
    // localStorage.removeItem('username');
  },
  watch: {
    '$route'(to, from) {
      console.log('路由变化:', { from: from.path, to: to.path });
      console.log('路由匹配组件:', to.matched);
    }
  }
};
</script>

<style>
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #121226;
  min-height: 100vh;
}

#app {
  position: relative;
  min-height: 100vh;
}

.router-container {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}
</style>